package cn.xianshu.web.controller;


import cn.xianshu.dto.SendSmsDto;
import cn.xianshu.service.IVerifyCodeService;
import cn.xianshu.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("verifycode")
public class VerifyCodeController {

    @Autowired
    private IVerifyCodeService verifyCodeService;


    @GetMapping("/imageCode/{key}")
    public AjaxResult imageCode(@PathVariable("key") String key){
        String image = verifyCodeService.imageCode(key);
        return AjaxResult.me().setResultObj(image);
    }

    @PostMapping("/sendSmsCode")
    public AjaxResult sendSmsCode(@RequestBody SendSmsDto dto){
        verifyCodeService.sendSmsCode(dto);
        return AjaxResult.me();
    }





}
